#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> fun(int x)
{
	vector<int> ans;
	for (int i = 1; i <= x / i; i++) {
		if (x % i == 0) {
			ans.push_back(i);
			if (i != x / i) {
				ans.push_back(x / i);
			}
		}
	}
	sort(ans.begin(), ans.end());
	return ans;
}
int main()
{
	int t;
	cin >> t;
	while (t--) {
		int x;
		cin >> x;
		auto ans = fun(x);
		for (auto t : ans) {
			cout << t << " ";
		}
		cout << endl;
	}
	return 0;
}
